-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for packetfilter API and iptables driver #2835
Conversation
🤖 Created branch: z_pr2835/yboaron/packetfilter |
45c33e3
to
29c8246
Compare
29c8246
to
82a071c
Compare
Since the |
aa36ab1
to
9712f16
Compare
b935856
to
c2f5e8c
Compare
@@ -95,8 +96,8 @@ func (w *egressPodWatcher) onCreateOrUpdate(obj runtime.Object, _ int) bool { | |||
|
|||
logger.V(log.DEBUG).Infof("Pod %q with IP %s created/updated", key, pod.Status.PodIP) | |||
|
|||
if err := w.namedIPSet.AddEntry(pod.Status.PodIP, true); err != nil { | |||
logger.Errorf(err, "Error adding pod IP %q to IP set %q", pod.Status.PodIP, w.ipSetName) | |||
if err := w.pfIface.AddEgressPodIP(w.gnHandle, pod.Status.PodIP); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose we have a use-case where we want all the pods from a certain namespace to use a specific egressIP, we create a namedIPSet which has a unique name created using the key (i.e., namespace/name) and and store the PodIPs that are part of that namespace. It is not clear if we are doing the same in the new code. Can you explain how we are handling it? Is gnHandle supposed to be a unique name derived based on the key?
I pushed #2871 based on my comments to serve as a starting point for the general structure. I left the packetfilter interface the same as it was. I think the logical next step would be to generalize the interface as is done in this PR. Then I think it would be useful to implement the interface using nftables and see if any changes are needed. Eg, can |
Yes. Kindnet programs certain IPtable rules mainly to perform MASQ for outbound traffic so that the pods can reach internet. As you are familiar, |
Signed-off-by: Tom Pantelis <[email protected]>
273ee7a
to
6aced5b
Compare
Signed-off-by: Yossi Boaron <[email protected]>
ca8fb1d
to
259219e
Compare
With the latest version I pushed, we have the history pointing to the prev files for the relevant files [1] , [1] |
My Q was more about the nftables tables Submariner should use/create, I guess we can't assume that default tables/chains (iptables-nft) will always be there, WDYT? meaning we should create our own table. |
That looks good. |
AFAICT, if some component is using "iptables" (with However, when a component has fully migrated to support Personally, I feel in |
46070c3
to
1e9e055
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, just some min or things.
Please update the summary for 65c28b2 to reflect that we didn't add general MSS clamping and GN APIs. Also remove "1. Packetfilter component, auto-detecting hardcoded to iptables.".
Similarly please update the PR summary.
To allow a smooth transition to nftables a new packetfilter component is introduced, packetfilter provides an API for creating chains and rules in a generic way and should include pluggable drivers for iptables and nftables. Packetfilter also includes a static function that defines the driver to use. This commit includes: - Refactoring the current iptables code to be used as pluggable driver. - Fake driver implementation for unit tests. Co-authored-by: Tom Pantelis <[email protected]> Signed-off-by: Yossi Boaron <[email protected]>
Signed-off-by: Yossi Boaron <[email protected]>
🤖 Closed branches: [z_pr2835/yboaron/packetfilter] |
To allow smooth transition to nftables a new packetfilter component is introduced, packetfilter
provides an API to create chains, and rules in a generic way and should
include pluggable drivers for iptables and nftables.
Packetfilter also includes a static function that defines the driver to use.
This PR includes:
Generic named set API will be pushed in a separate PR.
check [1] for nftables support high level design .
Co-authored-by: Tom Pantelis [email protected]
[1]
https://docs.google.com/document/d/1PAjU61XUGaQ2qZZu_66clxadC997lsBGYcjydYEayR0/edit?usp=sharing